package com.changgou.search.listener;

import com.changgou.search.config.RabbitmqConfig;
import com.changgou.search.service.EsMangerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @description: 监听消息mq队列
 * @author: 大佬味的小男孩
 * @date: 2020-07-22 23:12
 **/
@Component
public class GoodsDeleteListener {

    @Autowired
    private EsMangerService esMangerService;

    @RabbitListener(queues = RabbitmqConfig.SEARCH_DELETE_QUEUE)
    public void receiveMessage(String spuId) {
        System.out.println("删除es索引库的spuid：" + spuId);
        //根据spuid删除es索引库中相关的sku数据
        esMangerService.delDataBySpuId(spuId);
    }

}
